package com.xhsj.user.hr.process.hrLeaveProcess.mapper;

import com.xhsj.user.hr.process.hrLeaveProcess.query.AllLeaveTimeListByLeaveDateQuery;
import com.xhsj.user.hr.process.hrLeaveProcess.query.LeaveTimeQuery;
import com.xhsj.user.hr.process.hrLeaveProcess.vo.FindToDoListVo;
import com.xhsj.user.hr.system.vo.LeaveTimeVo;
import org.apache.ibatis.annotations.Mapper;
import com.xhsj.user.hr.process.hrLeaveProcess.entity.TbHrApprovalLeaveTime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;
/**
 * <p>
 * 流程-hr请假时间表 Mapper 接口
 * </p>
 *
 * @author liuqinghua
 * @since 2020-09-01
 */
@Mapper
public interface TbHrApprovalLeaveTimeMapper extends BaseMapper<TbHrApprovalLeaveTime> {

    /**
     * 请假申请时间
     * @author liuqinghua
     * @date Sep 1, 2020 10:07:11 AM
     */
    List<LeaveTimeQuery> getLeaveTimeList(@Param("dataIdList") List<Long> dataIdList,
                                          @Param("businessId") Long businessId);

    /**
     * 删除相对应的时间
     * @author liuqinghua
     * @date Sep 1, 2020 10:07:11 AM
     */
    int deleteByDataId(@Param("dataId") Long dataId);

    List<AllLeaveTimeListByLeaveDateQuery> allLeaveTimeListByLeaveDate(@Param("dataId") Long dataId);

    int insertTime(@Param("time") TbHrApprovalLeaveTime time);

    // 删除请假时间通过id
    int deleteTureById(@Param("id") Long id);

    /**
     * 根据开始时间和结束时间查询用户请假时间
     * @author 苏小林
     * @date 2020/11/5 10:29
     * @param: applyUserId
     * @param: monthStart
     * @param: monthEnd
     * @return: java.util.List<com.xhsj.user.hr.system.vo.LeaveTimeVo>
     */
    List<LeaveTimeVo> getCurrentLeaveTimeByApplyUserId(@Param("applyUserId") Long applyUserId,
                                                       @Param("startDate") LocalDate startDate,
                                                       @Param("endDate") LocalDate endDate);

    /**
     * 查询待办列表
     * @author 苏小林
     * @date 2021/4/14 16:41
     * @param: userId
     * @param: roleIds
     * @return: java.util.List<com.xhsj.user.hr.process.hrLeaveProcess.vo.FindToDoListVo>
     */
    List<FindToDoListVo> findToList(@Param("userId") Long userId, @Param("roleIds") List<Long> roleIds);


    List<LeaveTimeVo> findListByIdAndBusinessId(@Param("dataId") Long dataId, @Param("businessId") Long businessId);
}
